﻿
namespace Core.Net
{
    public enum RPCType
    {
        none = 0,
        FromHost = 1,
        FromClient = 2,
        FromeClientCallBack = 4,
        FromHostCall = 8, //来自服务器的真实回掉方法
        Proto=16 //纯协议内容 
    }

    public enum RPCErrorType
    {
        None = 0,//无错误
        TimeOut = 1, //请求超时
        ClearRPC = 2, //连接失效
        CustomDefineError  //自定义错误
    }
    
    public enum ProtolcalType
    {
        none = 0,
        Ahead = 1, //TypeA
        Background = 2, //TypeB
        RealTime = 3 //实时类型，主要用于同步位置，Ping等。
    }

    [System.AttributeUsage(System.AttributeTargets.Method|System.AttributeTargets.Field, AllowMultiple = true)]
    public class RPCMethord : System.Attribute
    {
        public RPCType rpcType = RPCType.none;
        public ProtolcalType protoType = ProtolcalType.Background;
        //回调函数对应的名称
        public string FuncName = "null";
        //是否自动生成Callback函数
        public bool GenCallBack = false;
        public System.Type[] callBackParam; 
        //public bool onlyCallFromHost
        //{
        //    get { return (rpcType & RPCType.fromHost)!=0; }
        //    set
        //    {
        //    }
        //}
        public RPCMethord()
        {
        }
    }
}
